import { Component, OnInit } from '@angular/core';
import { nameplate_data, testInfo_data } from '../mock';
import { nameplate_keys, testInfo_keys } from '../constant'

@Component({
    selector: 'equip-base-info',
    template: `<nz-tabset>
        <nz-tab nzTitle='铭牌信息'>
            <div class='nameplateContainer'>
                <div>
                    <div class='nameplate-row' *ngFor='let item of namesKeys '>
                        <div class='row-key'>
                            {{nameplate_keys_map[item]}}
                        </div>
                        <div class='row-value'>
                            ：{{nameplate[item]}}
                        </div>
                    </div>
                </div>
                <div>

                </div>
            </div>
        </nz-tab>
        <nz-tab nzTitle='出厂试验信息'>
            <div class='testInfoContainer'>
                <div *ngFor="let item of testinfoKeys">
                   <span> {{testInfo_keys_map[item]}}：</span><span>{{testInfo[item]?'正常':'异常'}}</span>
                </div>
            </div>
        </nz-tab>
    </nz-tabset>`,
    styleUrls: ['./components.less']
})

export class BaseInfoComponent implements OnInit {
    nameplate: object
    testInfo: object
    nameplate_keys_map = nameplate_keys
    testInfo_keys_map = testInfo_keys
    namesKeys ; testinfoKeys
    ngOnInit() {
        this.nameplate = nameplate_data
        this.testInfo = testInfo_data
        this.namesKeys = Object.keys(nameplate_data)
        this.testinfoKeys = Object.keys(testInfo_data)
    }
}